package com.dtx.service;

import cn.hutool.core.io.FileUtil;
import com.dtx.entity.SysFile;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

public interface IFileService {

    void insert(SysFile sysFile);

    String upload(InputStream inputStream, String name) throws IOException;

    default void mkdirs(String fileDirectoryAddress) {
        File fileDirectory = new File(fileDirectoryAddress);
        if (!FileUtil.exist(fileDirectory) && !FileUtil.isDirectory(fileDirectory)) {
            System.out.println(fileDirectory + "//本地图片存放目录不存在，自动创建");
            fileDirectory.mkdirs();
        }
    }
}
